/*
 * Copyright (c) 2021 HiSilicon (Shanghai) Technologies CO., LIMITED.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef HTTP_UTIL_H
#define HTTP_UTIL_H

#include <stdint.h>
#include <stdbool.h>
#include "http_def.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
    通过文件名后缀返回content-type.
*/
const char* FileExtToCtt(const char* filePath);

/**
    errno to http2 error code.
*/
uint32_t ErrnoToH2Code(int err);

/**
    获取stream type的名称.
*/
const char* H2StrmTypeStr(uint8_t type);

/**
    http method string to code.
*/
uint32_t HttpMethodToCode(const char* method);

/**
    http method list string to codes.
*/
uint32_t HttpMethodsToCodes(const char* methods);

/**
    http method code to string.
*/
const char* HttpCodeToMethod(uint32_t mcode);

#ifdef __cplusplus
}
#endif

#endif // HTTP_UTIL_H
